# $Id$
# Maintainer: AndyRTR <andyrtr@archlinux.org>
# Maintainer: Jan de Groot <jgc@archlinux.org>

pkgname=xf86-video-intel-dri3
pkgver=2.99.917
pkgrel=1
arch=(i686 x86_64)
url="http://xorg.freedesktop.org/"
license=('custom')
install=$pkgname.install
pkgdesc="X.org Intel i810/i830/i915/945G/G965+ video drivers with dri3 support"
depends=('mesa-dri' 'libxvmc' 'pixman' 'xcb-util>=0.3.9')
makedepends=('xorg-server-devel' 'X-ABI-VIDEODRV_VERSION=19' 'libx11' 'libxrender'
             # additional deps for intel-virtual-output
            'libxrandr' 'libxinerama' 'libxcursor' 'libxtst')
optdepends=('libxrandr: for intel-virtual-output'
            'libxinerama: for intel-virtual-output'
            'libxcursor: for intel-virtual-output'
            'libxtst: for intel-virtual-output')
replaces=('xf86-video-intel-uxa' 'xf86-video-intel-sna')
provides=('xf86-video-intel-uxa' 'xf86-video-intel-sna')
conflicts=('xorg-server<1.16' 'X-ABI-VIDEODRV_VERSION<19' 'X-ABI-VIDEODRV_VERSION>=20'
           'xf86-video-intel-sna' 'xf86-video-intel-uxa' 'xf86-video-i810' 'xf86-video-intel-legacy'
           'xf86-video-intel')
groups=('xorg-drivers' 'xorg')
source=(${url}/archive/individual/driver/${pkgname}-${pkgver}.tar.bz2
        git-fixes.patch)
sha256sums=('00b781eea055582820a123c47b62411bdf6aabf4f03dc0568faec55faf9667c9'
            '3b38b844fbc8088401ebbbafbbf1399d87f077caa5020cbd822487b7d26514e0')

prepare() {
  cd ${pkgname}-${pkgver}
  # fix FS#43840, FS#43906
  patch -Np1 -i ../git-fixes.patch
}

build() {
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr --libexecdir=/usr/lib \
    --enable-dri3
  make
}

check() {
  cd $pkgname-$pkgver
  make check
}

package() {
  cd ${pkgname}-${pkgver}

  make DESTDIR="${pkgdir}" install

  install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
  install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
}
